﻿Public Class FormMesWorkReportList
    Dim objPgdMesWorkReport As New clsPgdMesWorkReport
    Private Sub FormMesWorkReportList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim startDate As String = Date.Now.ToShortDateString()
        DLStartDate.Text = startDate
        Dim endDate As String = Date.Now.ToShortDateString()
        DLEndDate.Text = endDate
        setDgvData()
    End Sub

    Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
        setDgvData()
    End Sub

    Private Sub setDgvData()
        Dim dt As DataTable = objPgdMesWorkReport.getList(DLStartDate.Text & " 00:00:00.000", DLEndDate.Text & " 23:59:59.999")
        If dt.Rows.Count > 0 Then
            dt.Columns.Add("validity_name")
            For Each row As DataRow In dt.Rows
                If row("validity") = "0" Then
                    row("validity_name") = "无效"
                Else
                    row("validity_name") = "有效"
                End If
            Next
        End If
        dgv.AutoGenerateColumns = False
        dgv.DataSource = dt
    End Sub
End Class